package br.diego.tb.elementaryData;

public class LongestImprovement 
{

	public static int longest_improvement(Integer[] grades) 
	{
		int longestImprovement = 1;
		int longestImprovementCandidate = 1;
		
		for(int i = 1; i < grades.length; i ++)
		{
			int thisGrade = grades[i];
			int previousGrade = grades[i - 1];
			
			
			if(thisGrade >= previousGrade)
				longestImprovementCandidate ++;
			
			if(thisGrade < previousGrade)
			{
				longestImprovement = (longestImprovementCandidate > longestImprovement) ? longestImprovementCandidate : longestImprovement;
				longestImprovementCandidate = 1;
				
			}
			
		}
		
		longestImprovement = (longestImprovementCandidate > longestImprovement) ? longestImprovementCandidate : longestImprovement;
		
		System.out.println(longestImprovement);
		
		return longestImprovement;
    }
}
